package com.youhome.business.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.persistence.Lob;
import javax.validation.constraints.*;

/**
 * Created by chen365 on 2019/01/23.
 */
@Data
@ApiModel
public class DTONews {
    @ApiModelProperty(value = "新闻ID", readOnly = true, position = 0)
    private Long id;

    @NotBlank(message = "标题不能为空")
    @Length(min = 3, max = 120, message = "标题长度必须在3个字符到120个字符间")
    @ApiModelProperty(value = "新闻标题", position = 1)
    private String title;

    @NotBlank(message = "内容不能为空")
    @Lob
    @ApiModelProperty(value = "新闻内容", position = 2)
    private String content;

    @NotNull(message = "新闻类别不能为空")
    @ApiModelProperty(value = "新闻类别", position = 3)
    private Integer type;

    @Lob
    @ApiModelProperty(value = "新闻摘要", position = 4)
    private String summary;

    @ApiModelProperty(value = "新闻图片", position = 5)
    private String photo;

    @ApiModelProperty(value = "新闻作者", position = 6)
    private String author;

    @ApiModelProperty(value = "是否置顶", position = 7)
    private Integer istop;

    @ApiModelProperty(value = "新闻来源", position = 8)
    private String source;

    @Min(value = 0, message = "排序不能小于0")
    @Max(value = 100, message = "排序不能大于100")
    @ApiModelProperty(value = "新闻排序", position = 9)
    private Integer order;

    @Pattern(
            regexp = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\\\\d{8}$",
            message = "手机号格式不合法"
    )
    @ApiModelProperty(value = "手机", position = 10)
    private String phone;

}
